﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public enum Direction
{
    None = 0,
    Up = 1,
    Left = 2,
    Down = 3,
    Right = 4,    
}

public class MotionController : MonoBehaviour
{
    public float speed = 1f;
    public Vector3 movePosition;
    public float maxSpeed = 10;

    private void Awake()
    {
        movePosition = transform.position;
    }

    private void FixedUpdate()
    {
        Move();
    }

    private void Move()
    {
        var moveVector = movePosition - transform.position;
        if (moveVector.sqrMagnitude >= 0.05f)
        {
            Vector3 velocity = moveVector.normalized;
            transform.position += velocity * maxSpeed * Time.fixedDeltaTime;
        }
    }
}
